import http from '@/axios/http.js';
import baseUrl from '@/constant/user/apiUrl.js';
//import mock from '@/mock/api/index/data.js';

const env = import.meta.env.VITE_MODE_NAME;

export default {
	//关注列表信息
	getFollowList(uid,pageDto) {
		if (env == 'development') {
			return http.post(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.follow + uid,pageDto);
		} else if (env == 'test') {
			return http.post(import.meta.env.VITE_API_URL_INFO + baseUrl.follow + uid,pageDto);
		}
	},
	//粉丝列表信息
	getFansList(uid) {
		if (env == 'development') {
			return http.get(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.fans + uid);
		} else if (env == 'test') {
			return http.get(import.meta.env.VITE_API_URL_INFO + baseUrl.fans + uid);
		}
	},
	//收藏列表信息
	getSaveList(uid,pageDto){
		if (env == 'development') {
			return http.post(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.save + uid,pageDto);
		} else if (env == 'test') {
			return http.post(import.meta.env.VITE_API_URL_INFO + baseUrl.save + uid,pageDto);
		}
	},
	//获取登录的用户信息
	getUserInfo(uid) {
		if (env == 'development') {
			return http.get(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.userInfo + uid);
		}
		else if (env == 'test') {
			return http.get(import.meta.env.VITE_API_URL_INFO + baseUrl.userInfo + uid);
		}
	},
	//查询用户未支付订单
	getWaitOrderList(uid,pageDto){
		if (env == 'development') {
			return http.post(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.waitPay + uid,pageDto);
		} else if (env == 'test') {
			return http.post(import.meta.env.VITE_API_URL_PAYMENT + baseUrl.waitPay + uid,pageDto);
		}
	},
	//关注用户功能
	focusUser(fid,uid){
		if (env == 'development') {
			return http.post(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.focusUser + fid + '/' + uid);
		} else if (env == 'test') {
			return http.post(import.meta.env.VITE_API_URL_INFO + baseUrl.focusUser + fid + '/' + uid);
		}
	},
	//取消关注用户功能
	cancelFocusUser(fid,uid){
		if (env == 'development') {
			return http.post(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.cancelFocusUser + fid + '/' + uid);
		} else if (env == 'test') {
			return http.post(import.meta.env.VITE_API_URL_INFO + baseUrl.cancelFocusUser + fid + '/' + uid);
		}
	},
	//头像上传
	uploadUserAvatar(uid,file){
		if (env == 'development') {
			return http.post(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.uploadAvatar + uid,file);
		} else if (env == 'test') {
			return http.post(import.meta.env.VITE_API_URL_INFO + baseUrl.uploadAvatar + uid,file);
		}
	},
	//删除用户收藏的文章
	deleteMySave(aid,uid){
		if (env == 'development') {
			return http.delete(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.deleteMySave + aid + '/' + uid);
		} else if (env == 'test') {
			return http.delete(import.meta.env.VITE_API_URL_INFO + baseUrl.deleteMySave + aid + '/' + uid);
		}
	},
	//更改用户信息
	updateSelfInfo(uid,UserDto){
		if (env == 'development') {
			return http.put(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.updateSelfInfo + uid,UserDto);
		} else if (env == 'test') {
			return http.put(import.meta.env.VITE_API_URL_INFO + baseUrl.updateSelfInfo + uid,UserDto);
		}
	},
	//取消用户订单
	cancelWaitOrder(orderId){
		if (env == 'development') {
			return http.delete(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.cancelWaitOrder + orderId);
		} else if (env == 'test') {
			return http.delete(import.meta.env.VITE_API_URL_PAYMENT + baseUrl.cancelWaitOrder + orderId);
		}
	}
}